package com.Archive.firstWeek;

import java.util.Random;

public class Star {
    public int connerBlank, lineBlank, byteBlank;

    public void lineDisplay(int starLine) {
        int byteCache = byteBlank;
        while (byteCache > 0) {
            System.out.print(" ");
            byteCache--;
        }
        for (int i = starLine; i > 0; i--) {
            System.out.print(" ");
        }
        for (int j = starLine; j < connerBlank + 1; j++) {
            System.out.print("* ");
        }
        for (int i = starLine - 1; i > 0; i--) {
            System.out.print(" ");
        }
        System.out.println("");
    }

    public void Display(int starCache) {
        for (int k = starCache; k > 0; k--)
            lineDisplay(k);
        for (int k = 2; k < starCache + 1; k++)
            lineDisplay(k);
    }

    public void startDisplay() {
        while (lineBlank > 0) {
            System.out.println("");
            lineBlank--;
        }
        Display(connerBlank);
    }

    public void randomNum(){
        Random rand = new Random();
        connerBlank = rand.nextInt(10) + 3;
        lineBlank = rand.nextInt(38) + 2;
        byteBlank = rand.nextInt(100) + 2;
//        System.out.println(connerBlank +"|"+lineBlank+"|"+byteBlank);
    }

    public  void cleanDisplay(){
        for (int c = 38;c > 0;c--){
            System.out.println("");
        }
    }
    public static void main(String[] args) throws InterruptedException {
            Star s = new Star();
//        for (int v = 1;v < 110;v++){
//            System.out.println(v);
//        }
        for(;;) {
            s.cleanDisplay();
            s.randomNum();
            s.startDisplay();
            Thread.sleep(500);
        }
    }
}
